
import 'package:flutter/material.dart';
import 'package:ycbl/config/bl_color.dart';

/// 有边框的标签
class BorderLabel extends StatelessWidget {

  /// 边框圆角大小
  final double borderRadius;
  /// 边框宽度
  final double borderWidth;
  /// 边框颜色
  final Color borderColor;
  /// 内边距
  final EdgeInsetsGeometry padding;
  /// 文字
  final String text;
  /// 文字样式
  final TextStyle textStyle;

  const BorderLabel({
    Key key,
    this.text,
    this.borderRadius = 2.0,
    this.borderWidth = 0.7,
    this.borderColor = BLColor.orangeLabelColor,
    this.padding = const EdgeInsets.fromLTRB(8, 0, 8, 1) , //中文基准线有点偏下，所以底部多了边距
    this.textStyle = const TextStyle(fontSize: 11, color: BLColor.orangeLabelColor,)
  }) : super(key: key);


  @override
  Widget build(BuildContext context) {

    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
        border: Border.all(
          width: borderWidth,
          color: borderColor,
        ),
      ),
      padding: padding,
      child: Center(
        child: Text(
          text ?? '',
          style: textStyle,
        ),
      ),
    );
  }
}
